<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>血液退回血站申请</title>
    <link rel="shortcut icon" type="image/x-icon" href="../../../../img/favicon.ico">
    <link rel="stylesheet" href="../../../../element-theme/blue/index.css">
    <style type="text/css">
        .tableLimit tr td .cell {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 1; /*可以显示的行数，超出部分用...表示 */
            -webkit-box-orient: vertical;
        }

        .el-form-item {
            margin: 20px 20px 0 0;
        }
    </style>
</head>
<body>

<div class="data-manage-table">
    <template>
        <el-form ref="form" :inline="true" style="padding:5px 20px 20px 20px;">
            <el-form-item label="血袋编号条码">
                <el-input placeholder="请输入血袋编号条码" v-model="pagination.barcode"></el-input>
            </el-form-item>
            <el-form-item label="拓展码">
                <el-input placeholder="请输入拓展码" v-model="pagination.extendCode"></el-input>
            </el-form-item>
            <el-form-item label="血液成分">
                <el-input placeholder="请输入血液成分" v-model="pagination.bloodComponent"></el-input>
            </el-form-item>
            <el-form-item label="血液数量">
                <el-input placeholder="请输入血液数量" v-model="pagination.bloodCount"></el-input>
            </el-form-item>
            <el-form-item label="ABO血型">
                <el-input placeholder="请输入ABO血型" v-model="pagination.aboBloodType"></el-input>
            </el-form-item>
            <el-form-item label="RH血型">
                <el-input placeholder="请输入RH血型" v-model="pagination.rhBloodType"></el-input>
            </el-form-item>
            <el-form-item label="失效时间">
                <el-date-picker v-model="pagination.failureTime" size="small" format="yyyy-MM-dd"
                                placeholder="请输入失效时间"></el-date-picker>
            </el-form-item>
            <el-form-item label="采集时间">
                <el-date-picker v-model="pagination.collectTime" size="small" format="yyyy-MM-dd"
                                placeholder="请输入采集时间"></el-date-picker>
            </el-form-item>
            <el-form-item label="血液来源">
                <el-input placeholder="请输入血液来源" v-model="pagination.bloodSource"></el-input>
            </el-form-item>
            <el-form-item label="状态">
                <el-input placeholder="请输入状态" v-model="pagination.state"></el-input>
            </el-form-item>
            <el-form-item label="入库金额">
                <el-input placeholder="请输入入库金额" v-model="pagination.inboundAmount"></el-input>
            </el-form-item>
            <el-form-item label="血液ID">
                <el-input placeholder="请输入血液ID" v-model="pagination.bloodId"></el-input>
            </el-form-item>
            <el-form-item label="血袋位置">
                <el-input placeholder="请输入血袋位置" v-model="pagination.bloodLocation"></el-input>
            </el-form-item>
            <el-form-item label="血液金额">
                <el-input placeholder="请输入血液金额" v-model="pagination.bloodAmount"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="getData">搜索</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="info" @click="reset">清空</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="danger" @click="batchDownload()">批量下载</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="danger" @click="batchDelete()">批量删除</el-button>
            </el-form-item>
        </el-form>

        <el-table ref="selectTable" :data="dataList" style="width: 100%" border
                  :header-cell-style="{'text-align': 'center','background': '#eef1f6'}" highlight-current-row
                  class="tableLimit" @row-click="handle" :cell-style="{'text-align':'center'}">
            <el-table-column type="selection"></el-table-column>
            <el-table-column fixed="left" prop="id" label="ID">
                <template slot-scope="scope">
                    <el-button type="text" @click="showData">{{scope.row.id}}</el-button>
                </template>
            </el-table-column>
            <el-table-column prop="barcode" label="血装编号条码"></el-table-column>
            <el-table-column prop="extendCode" label="扩展码"></el-table-column>
            <el-table-column prop="bloodComponent" label="血液成分">
                <template slot-scope="scope">
                    {{getBloodCompositionName(scope.row.bloodComponent)}}
                </template>
            </el-table-column>
            <el-table-column prop="bloodCount" label="血液数量">
                <template slot-scope="scope">
                    {{getBloodSizeName(scope.row.bloodCount)}}
                </template>
            </el-table-column>
            <el-table-column prop="aboBloodType" label="ABO血型">
                <template slot-scope="scope">
                    {{getAboTypeName(scope.row.aboBloodType)}}
                </template>
            </el-table-column>
            <el-table-column prop="rhBloodType" label="RH血型">
                <template slot-scope="scope">
                    {{getRhTypeName(scope.row.rhBloodType)}}
                </template>
            </el-table-column>
            <el-table-column prop="failureTime" label="失效时间"></el-table-column>
            <el-table-column prop="collectTime" label="采集时间"></el-table-column>
            <el-table-column prop="bloodSource" label="血液来源">
                <template slot-scope="scope">
                    {{getBloodSourceName(scope.row.bloodSource)}}
                </template>
            </el-table-column>
            <el-table-column prop="state" label="状态">
                <template slot-scope="scope">
                    {{getStateName(scope.row.state)}}
                </template>
            </el-table-column>
            <el-table-column prop="inboundAmount" label="入库金额"></el-table-column>
            <el-table-column prop="bloodId" label="血液ID"></el-table-column>
            <el-table-column prop="bloodLocation" label="血袋位置">
                <template slot-scope="scope">
                    {{getBloodLocationName(scope.row.bloodLocation)}}
                </template>
            </el-table-column>
            <el-table-column prop="bloodAmount" label="血液金额"></el-table-column>
            <el-table-column fixed="right" label="操作" align="center">
                <template slot-scope="scope">
                    <el-button size="mini" type="danger" @click="backBlood">退回血站</el-button>
                </template>
            </el-table-column>
        </el-table>

        <!--分页组件-->
        <div class="pagination-container">
            <el-pagination
                    class="pagination"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="pagination.currentPage"
                    :page-sizes="[2,4,6,8,10]"
                    :page-size="pagination.pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="pagination.total"
                    style="text-align: center; margin-top: 20px;">
            </el-pagination>
        </div>

        <el-dialog title="血站退血申请信息" center :visible.sync="sData" width="90%" :close-on-click-modal="false">
            <template>
                <el-descriptions class="margin-top" :column="3" :size="size" border>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            创建时间
                        </template>
                        {{shData.sGmtCreate}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            修改时间
                        </template>
                        {{shData.sGmtModified}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血装编号条码
                        </template>
                        {{shData.sBarcode}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            扩展码
                        </template>
                        {{shData.sExtendCode}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血液成分
                        </template>
                        {{getBloodCompositionName(shData.sBloodComponent)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血液数量
                        </template>
                        {{getBloodSizeName(shData.sBloodCount)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            ABO血型
                        </template>
                        {{getAboTypeName(shData.sAboBloodType)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            RH血型
                        </template>
                        {{getRhTypeName(shData.sRhBloodType)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            失效时间
                        </template>
                        {{shData.sFailureTime}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            采集时间
                        </template>
                        {{shData.sCollectTime}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血液来源
                        </template>
                        {{getBloodSourceName(shData.sBloodSource)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            状态
                        </template>
                        {{getStateName(shData.sState)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            入库金额
                        </template>
                        {{shData.sInBoundAmount}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血液ID
                        </template>
                        {{shData.sBloodId}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血袋位置
                        </template>
                        {{getBloodLocationName(shData.sBloodLocation)}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <i class="el-icon-user"></i>
                            血液金额
                        </template>
                        {{shData.sBloodAmount}}
                    </el-descriptions-item>
                </el-descriptions>
            </template>
        </el-dialog>

        <el-dialog title="血液退回血站申请" center :visible.sync="setData" width="90%" :close-on-click-modal="false">
            <template>
                <el-form :model="ruleForm" ref="ruleForm" label-width="100px" label-position="right" :rules="rules"
                         :inline="true">
                    <template>
                        <el-descriptions class="margin-top" :column="3" :size="size" border>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-user"></i>
                                    ID
                                </template>
                                {{backID}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-notebook-2"></i>
                                    血液ID
                                </template>
                                {{backBloodNumber}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-s-order"></i>
                                    退血单号
                                </template>
                                {{backNumber}}
                            </el-descriptions-item>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-edit"></i>
                                    退血原因
                                </template>
                                <el-form-item label="" prop="selectValue">
                                    <el-select v-model="ruleForm.selectValue" placeholder="请选择退血原因"
                                               @change="selectBackReason">
                                        <el-option
                                                v-for="item in options"
                                                :key="item.code"
                                                :label="item.reason"
                                                :value="item.reason"
                                                :disabled="item.disabled"
                                        />
                                    </el-select>
                                </el-form-item>
                            </el-descriptions-item>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-user"></i>
                                    申请人姓名
                                </template>
                                <el-form-item label="" prop="selectName">
                                    <el-select v-model="ruleForm.selectName" placeholder="请选择申请人姓名"
                                               @change="selectAppName">
                                        <el-option
                                                v-for="item in nameList"
                                                :key="item.code"
                                                :label="item.name"
                                                :value="item.code"
                                                :disabled="item.disabled"
                                        />
                                    </el-select>
                                </el-form-item>
                            </el-descriptions-item>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-s-platform"></i>
                                    申请人工号
                                </template>
                                <el-input placeholder="请选择申请人工号" v-model="backApplicantWorkNumber" disabled></el-input>
                            </el-descriptions-item>
                            <el-descriptions-item>
                                <template slot="label">
                                    <i class="el-icon-share"></i>
                                    申请时间
                                </template>
                                <el-form-item label="" prop="backApplyTime">
                                    <el-date-picker
                                            v-model="ruleForm.backApplyTime"
                                            type="date"
                                            placeholder="选择日期"
                                            size="small"
                                            format="yyyy-MM-dd">
                                    </el-date-picker>
                                </el-form-item>
                            </el-descriptions-item>
                        </el-descriptions>
                    </template>
                </el-form>
                <div slot="footer" class="dialog-footer" align="center">
                    <el-button @click="cancel()">重 置</el-button>
                    <el-button type="primary" @click="save()">提交</el-button>
                </div>
            </template>
        </el-dialog>

    </template>
</div>

<script src="../../../../plugins/vue-2.6.11/vue.js"></script>
<script src="../../../../plugins/axios-0.27.2/axios.min.js"></script>
<script src="../../../../icons/iconfont.js"></script>
<script src="/js/2.15.12/index.js"></script>
<link href="/css/2.15.12/index.min.css" rel="stylesheet">
<script src="/js/httpVueLoader.js"></script>
<script src="/js/jquery.min.js"></script>
<script>Vue.prototype.$ELEMENT = {size: 'medium'};</script>
<script>(
    function () {
        new Vue({
            el: '.data-manage-table',
            data() {
                return {
                    // 表单校验
                    ruleForm: {
                        selectValue: '',
                        bloodInf: '',
                        selectName: '',
                        backApplyTime: '',
                    },
                    rules: {
                        selectValue: [
                            {required: true, message: '请选择退血原因', trigger: 'change'}
                        ],
                        bloodInf: [
                            {required: true, message: '请选择血液信息', trigger: 'change'}
                        ],
                        selectName: [
                            {required: true, message: '请选择申请人姓名', trigger: 'change'}
                        ],
                        backApplyTime: [
                            {type: 'date', required: true, message: '请选择日期', trigger: 'change'}
                        ]
                    },
                    //表格信息
                    tableData: [],
                    setData: false,
                    backID: undefined,
                    backBloodNumber: undefined,
                    backBackBloodReason: undefined,
                    backBloodInformation: undefined,
                    backApplicantName: undefined,
                    backApplicantWorkNumber: undefined,
                    options: [
                        {
                            code: '01',
                            reason: 'ALT升高',
                        },
                        {
                            code: '02',
                            reason: 'HBsAg反应性',
                        },
                        {
                            code: '03',
                            reason: 'HCV抗原抗体联合检测反应性'
                        },
                        {
                            code: '04',
                            reason: 'HIV抗原抗体联合检测反应性'
                        },
                        {
                            code: '05',
                            reason: '梅毒反应性',
                        },
                        {
                            code: '06',
                            reason: '黄疸指数高',
                        },
                        {
                            code: '07',
                            reason: 'ABO血型亚型',
                        },
                        {
                            code: '08',
                            reason: '特殊抗体反应性',
                        },
                        {
                            code: '10',
                            reason: '过期血',
                        },
                        {
                            code: '11',
                            reason: '乳糜血',
                        },
                        {
                            code: '12',
                            reason: '凝块',
                        },
                        {
                            code: '13',
                            reason: '气泡',
                        },
                        {
                            code: '14',
                            reason: '破袋',
                        },
                        {
                            code: '15',
                            reason: '非标量',
                        },
                        {
                            code: '16',
                            reason: '析出',
                        },
                        {
                            code: '17',
                            reason: '保密性弃血',
                        },
                        {
                            code: '18',
                            reason: '标签破损',
                        },
                        {
                            code: '19',
                            reason: 'HIV-DNA检测反应性',
                        },
                        {
                            code: '20',
                            reason: 'HBV-DNA检测反应性',
                        },
                        {
                            code: '21',
                            reason: 'HCV-RNA检测反应性',
                        },
                        {
                            code: '22',
                            reason: '冷凝集',
                        },
                        {
                            code: '23',
                            reason: '溶血',
                        },
                        {
                            code: '24',
                            reason: '脂肪血',
                        },
                        {
                            code: '25',
                            reason: '热合口漏',
                        },
                        {
                            code: '26',
                            reason: '血型错误',
                        },
                        {
                            code: '27',
                            reason: '血小板聚集',
                        },
                        {
                            code: '28',
                            reason: '人为差错',
                        },
                        {
                            code: '99',
                            reason: '其他',
                        },
                    ],
                    Inf: [
                        {
                            code: '01',
                            inf: '信息一'
                        },
                        {
                            code: '02',
                            inf: '信息二'
                        },
                    ],
                    nameList: [
                        {
                            code: '01',
                            name: '张三'
                        },
                        {
                            code: '02',
                            name: '李四'
                        },
                        {
                            code: '03',
                            name: '王五'
                        },
                        {
                            code: '04',
                            name: '赵六'
                        },
                        {
                            code: '05',
                            name: '钱七'
                        },
                        {
                            code: '06',
                            name: '孙八'
                        },
                        {
                            code: '07',
                            name: '周九'
                        },
                        {
                            code: '08',
                            name: '吴十'
                        },
                    ],
                    backNumber: '',
                    id: undefined,
                    size: '',
                    user: {
                        "accountNonExpired": true,
                        "accountNonLocked": true,
                        "credentialsNonExpired": true,
                        "enable": false,
                        "enabled": false,
                        "jobnum": "",
                        "menuUrls": {
                            "menu": [{
                                "urls": [{
                                    "id": "11",
                                    "title": "11",
                                    "url": "/pages/error/403.html",
                                    "titleflag": "error"
                                }], "title": "testerror", "titleflag": "error"
                            }, {
                                "urls": [{
                                    "id": "22",
                                    "title": "5-5",
                                    "url": "/pages/error/505.html",
                                    "titleflag": "testerror"
                                }], "title": "testerror2", "titleflag": "testerror"
                            }]
                        },
                        "noLocked": false,
                        "personalization": {
                            "asideFold": false,
                            "mainTabsHeaderFixed": true,
                            "asideControlOpen": false,
                            "headerSkin": "colorful",
                            "headerFixed": false,
                            "skin": "brown",
                            "asideSkin": "dark",
                            "asideControlFixed": true
                        },
                        "username": ""
                    },
                    bloodCompositionList: [],
                    // 血液数量列表
                    bloodSizeList: [],
                    // ABO血型
                    aboTypeList: [],
                    // RH血型
                    rhTypeList: [],
                    // 血液来源
                    bloodSourceList: [],
                    //血液状态列表
                    stateList: [],
                    // 血液位置列表
                    bloodLocation: [],
                    sData: false,
                    shData: {
                        sGmtCreate: "",
                        sGmtModified: "",
                        sBarcode: "",
                        sExtendCode: "",
                        sBloodComponent: "",
                        sBloodCount: "",
                        sAboBloodType: "",
                        sRhBloodType: "",
                        sFailureTime: "",
                        sCollectTime: "",
                        sBloodSource: "",
                        sState: "",
                        sInBoundAmount: "",
                        sBloodId: "",
                        sBloodLocation: "",
                        sBloodAmount: "",
                    },
                    backReasonList: [],
                    //分页相关信息
                    pagination: {
                        currentPage: 1, //当前页码
                        pageSize: 4, //每页显示记录数
                        total: 0, //总记录数
                        // 需要根据查询的条件
                        barcode: "",
                        extendCode: "",
                        bloodComponent: "",
                        bloodCount: "",
                        aboBloodType: "",
                        rhBloodType: "",
                        failureTime: "",
                        collectTime: "",
                        bloodSource: "",
                        state: "",
                        inboundAmount: "",
                        bloodId: "",
                        bloodLocation: "",
                        bloodAmount: "",
                    },
                    dataList: [],
                }
            },
            //自动触发写入的函数
            created() {
                this.getData();
            },
            mounted() {
                this.user = sessionStorage.getItem("user") ? JSON.parse(sessionStorage.getItem("user")) : {};
                this.getBloodComposition();
                this.getBloodSize();
                this.getAboType();
                this.getRhType();
                this.getBloodSource();
                this.getState();
                this.getBloodLocation();
                this.getBackBloodReason();
            },
            methods: {
                getData() {
                    const url = "/bloodcanclestation/normal/instationinformation/" + this.pagination.currentPage + '/' + this.pagination.pageSize;
                    axios.get(
                        url,
                        {
                            params: {
                                barcode: this.pagination.barcode,
                                extendCode: this.pagination.extendCode,
                                bloodComponent: this.pagination.bloodComponent,
                                bloodCount: this.pagination.bloodCount,
                                aboBloodType: this.pagination.aboBloodType,
                                rhBloodType: this.pagination.rhBloodType,
                                failureTime: this.pagination.failureTime,
                                collectTime: this.pagination.collectTime,
                                bloodSource: this.pagination.bloodSource,
                                state: this.pagination.state,
                                inboundAmount: this.pagination.inboundAmount,
                                bloodId: this.pagination.bloodId,
                                bloodLocation: this.pagination.bloodLocation,
                                bloodAmount: this.pagination.bloodAmount,
                            }
                        }
                    ).then(res => {
                            if (res.data.code === "200") {
                                console.log(res.data);
                                this.pagination.pageSize = res.data.data.size;
                                this.pagination.currentPage = res.data.data.current;
                                this.pagination.total = res.data.data.total;
                                this.dataList = res.data.data.records;
                            } else {
                                this.$message.error(res.data.msg);
                            }
                        }
                    )
                },
                //批量删除
                batchDelete() {
                    if(JSON.parse(JSON.stringify(this.$refs.selectTable.selection)).length==0){
                        this.$notify({
                            title: '温馨提示：',
                            message: '您未选中数据，请重新操作！！！',
                            type: 'warning'
                        });
                        return;
                    }
                    let checkArr = JSON.parse(JSON.stringify(this.$refs.selectTable.selection));  // 存储了勾选到的数据
                    var ids=new Array()
                    for(var i=0;i<checkArr.length;i++){
                        ids[i]=checkArr[i].id;
                    }
                    console.log("打印所选编号")
                    console.log(ids)
                    //批量删除
                    this.$confirm('确定删除这些数据吗, 是否继续?', '批量删除', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        axios({
                            url: '/bloodcanclestation/normal/batchDeleteSb',
                            method: 'put',
                            dataType: 'json',
                            data:ids
                        }).then(res => {
                            if (res.data.code === '200') {
                                this.handleCurrentChange(this.pagination.currentPage);
                                this.$notify({
                                    tile: '温馨提示',
                                    message: '批量删除成功！！！',
                                    type: 'success'
                                })
                            } else {
                                this.$notify({
                                    tile: '警告',
                                    message: '删除出错',
                                    type: 'warning'
                                })
                            }
                        }).catch(err => {
                            this.$notify.error({
                                title: '错误',
                                message: '删除失败',
                            })
                        });
                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消删除'
                        });
                    });
                },
                // 分页查询 每页显示多少条数据
                handleSizeChange: function (pageSize) {
                    this.pagination.pageSize = pageSize;
                    this.getData()
                },

                //分页查询 切换页码
                handleCurrentChange: function (currentPage) {
                    this.pagination.currentPage = currentPage;
                    //执行查询
                    this.getData()
                },
                // 批量下载
                batchDownload() {
                    if (JSON.parse(JSON.stringify(this.$refs.selectTable.selection)).length == 0) {
                        this.$notify({
                            title: '温馨提示：',
                            message: '您未选中数据，请重新操作！！！',
                            type: 'warning'
                        });
                        return;
                    }
                    let checkArr = JSON.parse(JSON.stringify(this.$refs.selectTable.selection));  // 存储了勾选到的数据
                    var ids = new Array()
                    for (var i = 0; i < checkArr.length; i++) {
                        ids[i] = checkArr[i].id;
                    }
                    // 批量下载
                    this.$confirm('确定下载这些数据吗, 是否继续?', '批量打印', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        const a = document.createElement('a')
                        a.href = '/bloodcanclestation/normal/batchdownloadpba?' + 'ids=' + ids
                        a.click()
                    });
                },
                // 获取退血原因字典
                getBackBloodReason() {
                    axios.get('/backbloodreason/normal/query')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.backReasonList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的BackBloodReason字段的code转换成name
                getBackBloodReasonName(code) {
                    for (let i = 0; i < this.backReasonList.length; i++) {
                        if (this.backReasonList[i].code === code) {
                            return this.backReasonList[i].reason;
                        }
                    }
                },
                // 将表格中的BackBloodReason字段的reason转换成code
                getBackBloodReasonReason(reason) {
                    for (let i = 0; i < this.backReasonList.length; i++) {
                        if (this.backReasonList[i].reason === reason) {
                            return this.backReasonList[i].code;
                        }
                    }
                },
                // 获取血液位置字典
                getBloodLocation() {
                    axios.get('/bloodLocation/normal/getName')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.bloodLocation = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的BloodLocation字段的code转换成location
                getBloodLocationName(code) {
                    for (let i = 0; i < this.bloodLocation.length; i++) {
                        if (this.bloodLocation[i].code === code) {
                            return this.bloodLocation[i].location;
                        }
                    }
                },
                // 获取状态字典
                getState() {
                    axios.get('/state/normal/getName')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.stateList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的State字段的code转换成name
                getStateName(code) {
                    for (let i = 0; i < this.stateList.length; i++) {
                        if (this.stateList[i].code === code) {
                            return this.stateList[i].state;
                        }
                    }
                },
                // 获取血液来源字典
                getBloodSource() {
                    axios.get('/bloodSource/normal/getName')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.bloodSourceList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的BloodSource字段的code转换成name
                getBloodSourceName(code) {
                    for (let i = 0; i < this.bloodSourceList.length; i++) {
                        if (this.bloodSourceList[i].code == code) {
                            return this.bloodSourceList[i].source;
                        }
                    }
                },
                // 获取RH血型字典
                getRhType() {
                    axios.get('/rhType/normal/getName')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.rhTypeList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的RhType字段的code转换成name
                getRhTypeName(code) {
                    for (let i = 0; i < this.rhTypeList.length; i++) {
                        if (this.rhTypeList[i].code == code) {
                            return this.rhTypeList[i].name;
                        }
                    }
                },
                // 获取ABO血型字典
                getAboType() {
                    axios.get('/aboType/normal/getName')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.aboTypeList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的AboType字段的code转换成name
                getAboTypeName(code) {
                    for (let i = 0; i < this.aboTypeList.length; i++) {
                        if (this.aboTypeList[i].code == code) {
                            return this.aboTypeList[i].name;
                        }
                    }
                },
                // 获取血液数量字典
                getBloodSize() {
                    axios.get('/bloodSize/normal/getName1')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.bloodSizeList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的BloodSize字段的code转换成size
                getBloodSizeName(code) {
                    for (let i = 0; i < this.bloodSizeList.length; i++) {
                        if (this.bloodSizeList[i].code == code) {
                            return this.bloodSizeList[i].size;
                        }
                    }
                },
                // 获取血液成分字典
                getBloodComposition() {
                    axios.get('/bloodComposition/normal/getName')
                        .then((res) => {
                            if (res.data.code === '200') {
                                this.bloodCompositionList = res.data.data
                            } else {
                                this.$notify.error({
                                    title: '错误',
                                    message: '获取数据失败'
                                })
                            }
                        })
                },
                // 将表格中的BloodComposition字段的code转换成name
                getBloodCompositionName(code) {
                    for (let i = 0; i < this.bloodCompositionList.length; i++) {
                        if (this.bloodCompositionList[i].code === code) {
                            return this.bloodCompositionList[i].composition;
                        }
                    }
                },
                selectAppName(val) {
                    let obj = {};//定义对象集合
                    obj = this.nameList.find(item => {
                        return item.code === val; //筛选出匹配数据 返回对象
                    });
                    this.backApplicantName = obj.name;
                    this.backApplicantWorkNumber = obj.code;
                },
                reset() {
                    this.pagination.barcode = "";
                    this.pagination.extendCode = "";
                    this.pagination.bloodComponent = "";
                    this.pagination.bloodCount = "";
                    this.pagination.aboBloodType = "";
                    this.pagination.rhBloodType = "";
                    this.pagination.pRefundAmount = "";
                    this.pagination.failureTime = "";
                    this.pagination.collectTime = "";
                    this.pagination.bloodSource = "";
                    this.pagination.state = "";
                    this.pagination.inboundAmount = "";
                    this.pagination.bloodId = "";
                    this.pagination.bloodLocation = "";
                    this.pagination.bloodAmount = "";
                    this.dataList = undefined;
                    this.getData();
                },
                selectBackReason(val) {
                    console.log(val);
                    this.backBackBloodReason = val;
                },
                bloodInformation(val) {
                    this.backBloodInformation = val;
                },
                backBlood() {
                    this.setData = true;
                },
                getBackNumber() {
                    axios({
                        method: "get",
                        url: "/bloodcanclestation/normal/getbacknumber",
                        params: {
                            id: this.id,
                        },
                        headers: {
                            'Content-Type': 'application/json;charset=UTF-8'
                        }
                    }).then(
                        res => {
                            console.log(res.data.data);
                            this.backNumber = res.data.data;
                        }
                    );
                },
                handle(row) {
                    console.log(row);
                    this.backID = row["id"];
                    this.backBloodNumber = row["bloodId"];
                    this.id = row["id"];
                    this.shData.sGmtCreate = row["gmtCreate"];
                    this.shData.sGmtModified = row["gmtModified"];
                    this.shData.sBarcode = row["barcode"];
                    this.shData.sExtendCode = row["extendCode"];
                    this.shData.sBloodComponent = row["bloodComponent"];
                    this.shData.sBloodCount = row["bloodCount"];
                    this.shData.sAboBloodType = row["aboBloodType"];
                    this.shData.sRhBloodType = row["rhBloodType"];
                    this.shData.sFailureTime = row["failureTime"];
                    this.shData.sCollectTime = row["collectTime"];
                    this.shData.sBloodSource = row["bloodSource"];
                    this.shData.sState = row["state"];
                    this.shData.sInBoundAmount = row["inboundAmount"];
                    this.shData.sBloodId = row["bloodId"];
                    this.shData.sBloodLocation = row["bloodLocation"];
                    this.shData.sBloodAmount = row["bloodAmount"];
                    // 获取血站退血单号
                    this.getBackNumber();
                },
                showData() {
                    this.sData = true;
                },
                save() {
                    this.$refs.ruleForm.validate((valid) => {
                        if (valid) {
                            const params = {};
                            params.backInformationNumber = this.backNumber;
                            params.backBloodReason = this.getBackBloodReasonReason(this.backBackBloodReason);
                            params.applicantName = this.backApplicantName;
                            params.applicantNumber = this.backApplicantWorkNumber;
                            params.applyTime = this.ruleForm.backApplyTime;
                            params.bloodId = this.backBloodNumber;
                            axios({
                                method: "post",
                                url: "/bloodcanclestation/normal/application",
                                data: params,
                                headers: {
                                    'Content-Type': 'application/json;charset=UTF-8'
                                }
                            }).then(res => {
                                console.log(res.data);
                                if (res.data.code === "200") {
                                    this.getData();
                                    this.setData = false;
                                    this.$message.success("申请成功");
                                } else {
                                    this.$message.error(res.data.msg);
                                }
                            });
                        } else {
                            console.log('提交有误！');
                            return false;
                        }
                    })
                },
                //重置按钮
                cancel() {
                    this.$refs.ruleForm.resetFields();
                }
            }
        });
    })()
</script>

<style>
    .el-form-item {
        margin-bottom: 0px;
    }
</style>

</body>
</html>